home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1990-1992 Michael Davidson.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation.
- *
- * This software is provided "as is" without express or implied warranty.
- */
-
- #ifndef V86MODE_H
- #define V86MODE_H
-
- #include <sys/types.h>
- #include <sys/tss.h>
-
- #include "v86types.h"
-
-
- int V86Init();
- int V86MemMap(paddr_t, caddr_t, int);
- int V86MemUnmap(paddr_t, caddr_t, int);
- int V86IOEnable(unsigned, int);
- int V86IODisable(unsigned, int);
- int V86Run();
- char *V86ErrorMessage(int);
-
- /*
- * return values from V86Emulate()
- */
- #define ERR_V86_HALT (-1)
- #define ERR_V86_DIV0 (-2)
- #define ERR_V86_SGLSTP (-3)
- #define ERR_V86_BRKPT (-4)
- #define ERR_V86_OVERFLOW (-5)
- #define ERR_V86_BOUND (-6)
- #define ERR_V86_ILLEGAL_OP (-7)
- #define ERR_V86_ILLEGAL_IO (-8)
-
- /*
- * the V86 mode TSS
- */
- extern struct tss386 *v86tss;
-
- /*
- * macros for accessing 8, 16 and 32 bit registers in a TSS
- */
- #define EAX(t) ((t)->t_eax)
- #define AX(t) WORD(0, (t)->t_eax)
- #define AH(t) BYTE(1, (t)->t_eax)
- #define AL(t) BYTE(0, (t)->t_eax)
-
- #define EBX(t) ((t)->t_ebx)
- #define BX(t) WORD(0, (t)->t_ebx)
- #define BH(t) BYTE(1, (t)->t_ebx)
- #define BL(t) BYTE(0, (t)->t_ebx)
-
- #define ECX(t) ((t)->t_ecx)
- #define CX(t) WORD(0, (t)->t_ecx)
- #define CH(t) BYTE(1, (t)->t_ecx)
- #define CL(t) BYTE(0, (t)->t_ecx)
-
- #define EDX(t) ((t)->t_edx)
- #define DX(t) WORD(0, (t)->t_edx)
- #define DH(t) BYTE(1, (t)->t_edx)
- #define DL(t) BYTE(0, (t)->t_edx)
-
- #define ESI(t) ((t)->t_esi)
- #define SI(t) WORD(0, (t)->t_esi)
-
- #define EDI(t) ((t)->t_edi)
- #define DI(t) WORD(0, (t)->t_edi)
-
- #define EBP(t) ((t)->t_ebp)
- #define BP(t) WORD(0, (t)->t_ebp)
- #define ESP(t) ((t)->t_esp)
- #define SP(t) WORD(0, (t)->t_esp)
-
- #define DS(t) WORD(0, (t)->t_ds)
- #define ES(t) WORD(0, (t)->t_es)
- #define SS(t) WORD(0, (t)->t_ss)
- #define CS(t) WORD(0, (t)->t_cs)
- #define FS(t) WORD(0, (t)->t_fs)
- #define GS(t) WORD(0, (t)->t_gs)
-
- #define EIP(t) ((t)->t_eip)
- #define IP(t) WORD(0, (t)->t_eip)
-
- #define EFL(t) ((t)->t_eflags)
- #define FL(t) WORD(0, (t)->t_eflags)
-
- #endif /* V86MODE_H */
-